package com.lwq.dao.system;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lwq.model.system.SysRole;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Description:
 * Author: LiuWenQing
 * Datetime: 2021/6/10
 */
@Mapper
public interface RoleMapper extends BaseMapper<SysRole> {

    @Select("SELECT a.id FROM transit.sys_role a INNER JOIN transit.rel_user_role b ON a.id = b.role_id WHERE b.user_id = #{userId} AND a.status = #{status}")
    List<Long> getRoleIdByUserId(@Param(value="userId") Long userId, @Param(value="status") String status);

    @Select("SELECT a.* FROM transit.sys_role a INNER JOIN transit.rel_user_role b ON a.id = b.role_id WHERE b.user_id = #{userId} AND a.status = #{status}")
    List<SysRole> getRoleByUserId(@Param(value="userId") Long userId, @Param(value="status") String status);


}
